package cn.okcmd.myaop.web.controllers.biz2;

import cn.okcmd.myaop.aops.WebFlag;
import cn.okcmd.myaop.web.resps.CommonResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * create by caoqg on 2021/7/27
 * 功能说明:
 */
@Slf4j
@RestController
@RequestMapping("/api/b2")
public class B2_01Controller {

    @WebFlag("demo业务2")
    @GetMapping("test")
    public CommonResp<String> test(){
        log.info("biz2 testAn");
        return CommonResp.succ("this is test b2testAn");
    }

    @WebFlag("demo业务2")
    @GetMapping("testErr")
    public CommonResp<String> testErr(){
        log.info("biz2 testAn err");
        throw new IllegalStateException("fix status err");
    }

    @GetMapping("test1")
    public CommonResp<String> test1(){
        log.info("biz2 test1");
        return CommonResp.succ("this is test b2test1");
    }

    @GetMapping("test2")
    public CommonResp<String> test2(){
        log.info("biz2 test2");
        return CommonResp.succ("this is test b2test2");
    }
}
